package me.lc.hammerheads.scene;

import me.lc.hammerheads.core.GameManager;
import me.lc.hammerheads.entity.BGType;
import me.lc.hammerheads.layer.GameBgLayer;
import me.lc.hammerheads.layer.GameLayer;

import android.view.KeyEvent;

import com.wiyun.engine.nodes.Scene;

public class GameScene extends Scene {
	private static GameScene instance = null;
	private static Object sync_obj = new Object();

	public GameBgLayer gameBgLayer;
	public GameLayer gameLayer;

	private GameScene() {
		gameBgLayer = new GameBgLayer();
		addChild(gameBgLayer);
		gameLayer = new GameLayer();
		addChild(gameLayer);
	}

	public static GameScene make() {
		synchronized (sync_obj) {
			if (instance == null) {
				instance = new GameScene();
			}
			return instance;
		}
	}

	@Override
	public boolean wyKeyDown(KeyEvent event) {
		if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
			GameManager.instance.pauseGame();
			return true;
		}
		return super.wyKeyDown(event);
	}

}
